package com.eascs.web.o2o.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.eascs.app.dao.PageResult;
import com.eascs.site.page.PaginationInfo;
import com.eascs.site.page.SelectDataOption;
import com.eascs.site.view.ViewContext;
import com.eascs.site.view.button.AjaxButton;
import com.eascs.site.view.button.Button;
import com.eascs.tag.MenuTag;
import com.eascs.web.o2o.web.common.BaseMasterViewController;
import com.eascs.web.o2o.web.service.BankLimitService;

@Controller
@RequestMapping("/banklimit")
public class BankLimitController extends BaseMasterViewController {
	@Autowired
	private BankLimitService bankLimitService;

	@RequestMapping("/list")
	public String getProcessList(String processName, Integer pageIndex) {
		ViewContext.put(MenuTag.CURRENT_MENU_CODE, "BankLimit");
		PageResult<Object[]> pageResult = new PageResult<Object[]>();
		if (pageIndex == null) {
			pageIndex = 0;
		}
		Integer pageSize = 15;
		pageResult = bankLimitService.getBankLimitList(null, pageSize, pageIndex);
		String[] titles = { "合作银行名称", "银行额度", "更新人", "更新时间", "备注" };
		Button[] bottons = new Button[] { new AjaxButton("编辑", "/banklimit/update/index?id="),
				new AjaxButton("删除", "/banklimit/delete?id=") };

		SelectDataOption[] selectDataOptions = { new SelectDataOption("BANKTYPEO2O"), null, null, null, null, null };
		PaginationInfo paginationInfo = new PaginationInfo(pageResult, titles, "/process/template/list?pageIndex=");
		paginationInfo.setBuildPagingNavigation(true);
		paginationInfo.setSelectDataOptions(selectDataOptions);
		paginationInfo.setMoreButtons(bottons);
		ViewContext.put("paginationInfo", paginationInfo);
		return "/banklimit/limit_list";
	}
}
